package main

import (
	. "go_data_structures_and_algorithms/tool"
)

func main() {

	var arr = []int{7, 1, 3, 5, 7, 8, 5, 3, 3, 8, 4, 9, 0}

	maoPaoSort(arr)
	PrintSlice(arr)
}

func maoPaoSort(arr []int) {

	if arr == nil || len(arr) < 2 {
		return
	}
	for i := len(arr) - 1; i > 0; i-- {
		for j := 0; j < i; j++ {
			if arr[j] > arr[j+1] {
				Swap(arr, j, j+1)
			}
		}
	}
}
